<div class="modal fade" id="addAssetModal" tabindex="-1" role="dialog" aria-labelledby="addAssetModalLabel">
  <div class="modal-dialog" role="document">
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
        <h4 class="modal-title" id="addAssetModalLabel">Add Asset</h4>
      </div>
      <form [formGroup]="myForm">
        <div class="modal-body">

            <div class="form-group text-left">
              <label for="energyID">energyID</label>
                <input formControlName="energyID" type="text" class="form-control">              
            </div>
          
            <div class="form-group text-left">
              <label for="units">units</label>
                <input formControlName="units" type="text" class="form-control">              
            </div>
          
            <div class="form-group text-left">
              <label for="value">value</label>
                <input formControlName="value" type="number" step='any' class="form-control">              
            </div>
          
            <div class="form-group text-left">
              <label for="ownerID">ownerID</label>
                <input formControlName="ownerID" type="text" class="form-control">              
            </div>
          
            <div class="form-group text-left">
              <label for="ownerEntity">ownerEntity</label>
                  <textarea formControlName="ownerEntity" class="form-control" rows="3"></textarea>
            </div>
          
        </div>
        <div class="modal-footer">
          <button (click)="addAsset(myForm);" type="submit" class="btn btn-success" data-dismiss="modal">Submit</button>
          <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
        </div>
      </form>
    </div>
  </div>
</div>



<div class="modal fade" id="updateAssetModal" tabindex="-1" role="dialog" aria-labelledby="updateAssetModalLabel">
  <div class="modal-dialog" role="document">
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
        <h4 class="modal-title" id="updateAssetModalLabel">Update Asset</h4>
      </div>
      <form [formGroup]="myForm">
        <div class="modal-body">

            <div class="form-group text-left">
              <label for="energyID">energyID</label>
                <input [ngModel]="energyID"formControlName="energyID" type="text" class="form-control">              
            </div>
          
            <div class="form-group text-left">
              <label for="units">units</label>
                <input [ngModel]="units"formControlName="units" type="text" class="form-control">              
            </div>
          
            <div class="form-group text-left">
              <label for="value">value</label>
                <input [ngModel]="value" formControlName="value" type="number" step='any' class="form-control">              
            </div>
          
            <div class="form-group text-left">
              <label for="ownerID">ownerID</label>
                <input [ngModel]="ownerID"formControlName="ownerID" type="text" class="form-control">            
            </div>
          
            <div class="form-group text-left">
              <label for="ownerEntity">ownerEntity</label>
                  <textarea [ngModel]="ownerEntity" formControlName="ownerEntity" class="form-control" rows="3"></textarea>            
            </div>
          
        </div>
        <div class="modal-footer">
          <button (click)="updateAsset(myForm)" type="submit" class="btn btn-success" data-dismiss="modal">Submit</button>
          <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
        </div>
      </form>
    </div>
  </div>
</div>


<div class="modal fade" id="deleteAssetModal" tabindex="-1" role="dialog" aria-labelledby="deleteAssetModalLabel">
  <div class="modal-dialog" role="document">
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
        <h4 class="modal-title" id="deleteAssetModalLabel">Delete Asset</h4>
      </div>
      <form [formGroup]="myForm" (ngSubmit)="deleteAsset()">
        <div class="modal-body">
          Are you sure you want to delete this asset?
        </div>
        <div class="modal-footer">
          <button (click)="deleteAsset()" type="submit" class="btn btn-danger" data-dismiss="modal">Yes</button>
          <button type="button" class="btn btn-default" data-dismiss="modal">No</button>
        </div>
      </form>
    </div>
  </div>
</div>


<div class="container">
	<div *ngIf="errorMessage" class="alert alert-danger" role="alert">
		<strong>Error:</strong> {{errorMessage}}
	</div>
  <h1 id='assetName'>Energy Assets</h1>
  <div class="row">  
  </div>
  <br>
  <div class="row">
    <div class="col-md-12">
      <table class="table table-bordered table-responsive table-hover">
        <thead class="thead">
          <tr class="thead-cols">
            
                <th class="bc">Energy ID</th>

                <th class="bc">Owner ID</th>
            
                <th class="bc">Owner Entity</th>
            
                <th class="bc">Units</th>
            
                <th class="bc">Value</th>

          </tr>
        </thead>
        <tbody>
          <tr *ngFor="let asset of allAssets">
            
                <td>{{asset.energyID}}</td>

                <td>{{asset.ownerID}}</td>
            
                <td>{{asset.ownerEntity}}</td>
            
                <td>{{asset.units}}</td>
            
                <td>{{asset.value}}</td>
                                    
          </tr>
        </tbody>
      </table>
    </div>
  </div>
</div>
